package org.unit.testmgmt.ui.table;

/**
 * A cbobox entry with a label and an object.
 * 
 * @author Robert Streng
 *
 */
public class ComboboxEntry {

	private int key = 0;
	private String label = "";
	private Object value = "";
	
	public ComboboxEntry() {
		// nothing
	}
	
	/**
	 * @param key
	 * @param label
	 */
	public ComboboxEntry(int key, String label) {
		this.key = key;
		this.label = label;
		this.value = label;
	}

	/**
	 * @param key
	 * @param label
	 * @param value
	 */
	public ComboboxEntry(int key, String label, Object value) {
		this.key = key;
		this.label = label;
		this.value = value;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj == null)
			return false;
		if (obj instanceof ComboboxEntry)
			return key==((ComboboxEntry)obj).getKey();
		return false;
	}
	
	@Override
	public int hashCode() {
		return key;
	}
	
	/**
	 * @return key
	 */
	public int getKey() {
		return key;
	}
	
	/**
	 * @param key
	 */
	public void setKey(int key) {
		this.key = key;
	}
	
	/**
	 * @return label
	 */
	public String getLabel() {
		return label;
	}
	
	/**
	 * @param label
	 */
	public void setLabel(String label) {
		this.label = label;
	}
	
	/**
	 * @return value
	 */
	public Object getValue() {
		return value;
	}
	
	/**
	 * @param value
	 */
	public void setValue(Object value) {
		this.value = value;
	}
	
	@Override
	public String toString() {
		return getLabel();
	}
}
